/*
 * Title:        CloudScheduler Toolkit
 * Description:  a Toolkit for Modeling and Simulation of Job Scheduling and Resource Provisioning in Cloud System
 * Licence:      GPL - http://www.gnu.org/copyleft/gpl.html
 * Author:       Fuhui Wu
 *
 * Copyright (c) 2013-2014, The National University of Defense Technology, China
 */

package org.nudt.jCloud.infrastructure;

import java.util.ArrayList;
import java.util.List;

public class HomegeneousCluster extends Cluster{
	private int hostCount;
	private double mips;	//MIPS per Pe
	private int pe;			//num of Pe per host
	private int ram;		//ram per host(M)
	private int bw;			//bindwidth per host(M)
	private int storage;	//storage per host(M)

	public HomegeneousCluster(int hostCount, double mips, int pe, int ram, 
			int bw, int storage) {
		setHostCount(hostCount);
		setMIPS(mips);
		setPe(pe);
		setRam(ram);
		setBw(bw);
		setStorage(storage);
		init();
	}
	
	public void init(){
		super.init();
		for(int i=0; i<hostCount; ++i){
			List<Pe> peList = new ArrayList<Pe>();
			for(int j=0; j<pe; ++j){
				peList.add(new Pe(j,mips));
			}
			this.getHostList().add(new Host(i, peList, new RamProvisioner(ram), 
					new BwProvisioner(bw), new StorageProvisioner(storage)));
		}
	}

	/**
	 * @return the mIPS
	 */
	public double getMIPS() {
		return mips;
	}

	/**
	 * @param mIPS the mIPS to set
	 */
	public void setMIPS(double mips) {
		this.mips = mips;
	}

	/**
	 * @return the pe
	 */
	public int getPe() {
		return pe;
	}

	/**
	 * @param pe the pe to set
	 */
	public void setPe(int pe) {
		this.pe = pe;
	}

	/**
	 * @return the ram
	 */
	public int getRam() {
		return ram;
	}

	/**
	 * @param ram the ram to set
	 */
	public void setRam(int ram) {
		this.ram = ram;
	}

	/**
	 * @return the bw
	 */
	public int getBw() {
		return bw;
	}

	/**
	 * @param bw the bw to set
	 */
	public void setBw(int bw) {
		this.bw = bw;
	}

	/**
	 * @return the storage
	 */
	public int getStorage() {
		return storage;
	}

	/**
	 * @param storage the storage to set
	 */
	public void setStorage(int storage) {
		this.storage = storage;
	}

	public int getHostCount() {
		return hostCount;
	}

	public void setHostCount(int hostCount) {
		this.hostCount = hostCount;
	}

}
